<!DOCTYPE html>
<body>
<script src="../../../resources/js-test.js"></script>
<script>
if (window.internals)
    internals.runtimeFlags.langAttributeAwareFormControlUIEnabled = true;
else
    debug('Require DRT/WRT.');
</script>

<input id="input-ar" lang="ar-eg" type="number">
<input id="input-fr" lang="fr-fr" type="number">
<input id="input-en" lang="en-us" type="number">

<script>
debug('Putting some ASCII digit strings to a number input using localized digits.');
var arabicInput = document.getElementById('input-ar');
arabicInput.focus();
shouldBeEqualToString('document.execCommand("InsertText", false, "1234"); arabicInput.value', '1234');
arabicInput.value = '';
shouldBeEqualToString('document.execCommand("InsertText", false, "1.234"); arabicInput.value', '1.234');
arabicInput.value = '';
shouldBeEqualToString('document.execCommand("InsertText", false, "1,234"); arabicInput.value', '1234');

debug('');
debug('Putting some digit strings to a French number input.');
var frenchInput = document.getElementById('input-fr');
frenchInput.focus();
shouldBeEqualToString('document.execCommand("InsertText", false, "1234"); frenchInput.value', '1234');
frenchInput.value = '';
shouldBeEqualToString('document.execCommand("InsertText", false, "1,234"); frenchInput.value', '1.234');
frenchInput.value = '';
shouldBeEqualToString('document.execCommand("InsertText", false, "1.234"); frenchInput.value', '1.234');

debug('');
debug('Puttting some digit strings to an English number input.');
var englishInput = document.getElementById('input-en');
englishInput.focus();
shouldBeEqualToString('document.execCommand("InsertText", false, "1234"); englishInput.value', '1234');
englishInput.value = '';
shouldBeEqualToString('document.execCommand("InsertText", false, "1.234"); englishInput.value', '1.234');
englishInput.value = '';
shouldBeEqualToString('document.execCommand("InsertText", false, "1,234"); englishInput.value', '1234');


</script>
</body>
